package com.info.zhiduoduo.core.vo.auth;

import com.info.zhiduoduo.common.constants.system.UserType;

import java.util.Date;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
public class UserAuthVO {

	/** 用户id，比如创客id，企业id，合伙人id等 */
	private int userid;
	/** 用户类型，参考常量类：{@link UserType} */
	private int userType;

	/** 用户登录时间 */
	private Date loginTime;
	/** token颁发时间 */
	private Date tokenIssueTime;
	/** token过期时间，与redis的过期时间一致，如果不一致则以redis为准。即此字段只作记录 */
	private Date tokenExpireTime;

	public static UserAuthVO of(int userid, int userType) {
		return new UserAuthVO().setUserid(userid).setUserType(userType);
	}

	public static UserAuthVO of(int userid, int userType, Date loginTime) {
		return new UserAuthVO().setUserid(userid).setUserType(userType).setLoginTime(loginTime);
	}
}
